﻿using fastNpoi.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace fastNpoi.Attributes
{
    [AttributeUsage(AttributeTargets.Property)]
    public class NpoiAttribute: Attribute
    {
        /// <summary>
        /// 映射的字段名称
        /// </summary>
        public string HeaderName;
        /// <summary>
        /// 表格宽度
        /// </summary>
        public int ColumnWidth;
        /// <summary>
        /// 字段位置（越大越靠下,默认999）
        /// </summary>
        public int Position;
        /// <summary>
        /// 表头生效条件(默认导入导出都生效,表头生效指读取时读取这列,导出时生成这列)
        /// </summary>
        public OperationType OperationType;
        /// <summary>
        /// 是否合并单元格
        /// </summary>
        public bool MergeCell;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="ColumnMapperName">映射表头名称</param>
        public NpoiAttribute(string headerName,int columnWidth = 0, int position = 999, OperationType operationType = OperationType.Import_Export, bool mergeCell = false)
        {
            HeaderName = headerName;
            ColumnWidth = columnWidth;
            Position = position;
            OperationType = operationType;
            MergeCell = mergeCell;
        }
    }
}
